package com.ysm.freestyle.view.item

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.databinding.DataBindingUtil
import com.ysm.freestyle.R
import com.ysm.freestyle.databinding.ItemTransferDirectionBinding

class TransferItemView : ConstraintLayout {

    private var binding = ItemTransferDirectionBinding.inflate(LayoutInflater.from(context))

    init {
        LayoutInflater.from(context).inflate(R.layout.item_transfer_direction, this, true)

//        binding
    }

    constructor(context: Context) : this(context, null)
    constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)

    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)


    fun initRes(leftIv:Int, title:String, desc:String) : TransferItemView {
        var binding = DataBindingUtil.inflate<ItemTransferDirectionBinding>(
            LayoutInflater.from(context),R.layout.item_transfer_direction,this,false
        )
        binding.ivLeft.setImageResource(leftIv)
        binding.itemTitle.text = title
        binding.itemDesc.text = desc
        return this
    }




}